package com.yanqu.road.logic.activity.foxcard.game.effect;

import com.yanqu.road.entity.activity.foxcard.FoxConsumeCard;
import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.Collections;
import java.util.List;

/**
 * 结束购物,随机复制一张消耗卡，并给予其指定的版本效果
 * buffid|0|0|0|0|0
 */
public class FoxCardEffect25 extends FoxCardEffectBase {
    @Override
    protected void effectHandle(FoxCardGameLogic gameLogic, FoxHandCard handCard) {
        if (triggerType != eFoxCardTriggerType.SHOPPING_END) {
            return;
        }

        List<FoxConsumeCard> consumeCards = gameLogic.getGameData().getConsumeCards();
        if (consumeCards.isEmpty()) {
            return;
        }
        Collections.shuffle(consumeCards);

        FoxConsumeCard foxConsumeCard = consumeCards.get(0);

        int versionEffect = Integer.valueOf(effectConfig.getParamsList().get(0));
        gameLogic.addNewConsumeCard(foxConsumeCard.getCardType(), foxConsumeCard.getConfigId(), versionEffect);

    }
}
